package com.ssy.lingxi.system.entity;

import com.ssy.lingxi.system.handler.converter.JpaJsonToMapConverter;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import java.util.Map;

/**
* 会员配置实体类
* @author wrc
* @date 2020/5/9
*/
@Entity
@Table(schema = "public", name = "cf_member_config")
public class MemberConfig {


    //字段ID

    @Id
    private Long id;

    // 字段名称
    @Length(max=26,message = "字段名称最长26个字符")
    @Column(name  = "field_name")
    @ApiModelProperty(value = "字段名称")
    private String fieldName;

    // 中文名称 字段注释名字
    @Length(max=30,message = "中文名称 字段注释名字最长30个字符")
    @Column(name  = "annotation_name")
    @ApiModelProperty(value = "中文名称 字段注释名字")
    private String annotationName;

    //字段类型
    @Column(name  = "field_type")
    @ApiModelProperty(value = "字段类型")
    private String fieldType;

    //字段类型的附加属性
    @Convert(converter = JpaJsonToMapConverter.class)
    @Column(columnDefinition = "jsonb")
    @ApiModelProperty(value = "字段类型附加属性")
    private Map<String, Object> attr;

    // 字段长度
    @Column(name  = "field_length")
    @ApiModelProperty(value = "字段长度")
    private Integer fieldLength;


    // 是否为空
    @Column(name  = "is_null_state")
    @ApiModelProperty(value = "是否为空 1.是 0.否")
    private Integer isNullState;

    //分组名称
    @Length(max=30,message = "分组名称最长30个字符")
    @Column(name  = "group_name")
    @ApiModelProperty(value = "分组名称")
    private String groupName;

    //排序
    @Column(name  = "sort")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    //状态
    @Column(name  = "state")
    @ApiModelProperty(value = "状态:0.停用 1.启用")
    private Integer state;

    @Length(max=128,message = "帮助信息:最长128个字符")
    @Column(name  = "help")
    @ApiModelProperty(value = "帮助信息")
    private String  help;

    @Column(name  = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Long createTime;

    @Column(name  = "update_time")
    @ApiModelProperty(value = "更新时间")
    private Long updateTime;

    @Column(name  = "create_role_id")
    @ApiModelProperty(value = "创建人ID")
    private Long createRoleId;

    @Column(name  = "role_id")
    @ApiModelProperty(value = "角色ID")
    private Long roleId;

    @Column(name  = "tag_enum")
    @ApiModelProperty(value = "标签枚举值")
    private Integer tagEnum;

    @Column
    @ApiModelProperty(value = "校验规则枚举值")
    private Integer ruleEnum;

    @Column
    @ApiModelProperty(value = "变更是否需要审核")
    private Integer validate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getAnnotationName() {
        return annotationName;
    }

    public void setAnnotationName(String annotationName) {
        this.annotationName = annotationName;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public Map<String, Object> getAttr() {
        return attr;
    }

    public void setAttr(Map<String, Object> attr) {
        this.attr = attr;
    }

    public Integer getFieldLength() {
        return fieldLength;
    }

    public void setFieldLength(Integer fieldLength) {
        this.fieldLength = fieldLength;
    }

    public Integer getIsNullState() {
        return isNullState;
    }

    public void setIsNullState(Integer isNullState) {
        this.isNullState = isNullState;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getHelp() {
        return help;
    }

    public void setHelp(String help) {
        this.help = help;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public Long getCreateRoleId() {
        return createRoleId;
    }

    public void setCreateRoleId(Long createRoleId) {
        this.createRoleId = createRoleId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Integer getTagEnum() {
        return tagEnum;
    }

    public void setTagEnum(Integer tagEnum) {
        this.tagEnum = tagEnum;
    }

    public Integer getRuleEnum() {
        return ruleEnum;
    }

    public void setRuleEnum(Integer ruleEnum) {
        this.ruleEnum = ruleEnum;
    }

    public Integer getValidate() {
        return validate;
    }

    public void setValidate(Integer validate) {
        this.validate = validate;
    }
}
